package com.linewow.xhyy.nihaonew.test;

import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import com.linewow.xhyy.nihaonew.R;
import com.linewow.xhyy.nihaonew.base.BaseFragmentActivity;
import com.squareup.picasso.Picasso;

import org.lasque.tusdk.core.TuSdk;
import org.lasque.tusdk.core.secret.StatisticsManger;
import org.lasque.tusdk.core.seles.tusdk.FilterManager;
import org.lasque.tusdk.modules.components.ComponentActType;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by LXR on 2016/9/23.
 */
public class ZActivity extends BaseFragmentActivity {
    @Bind(R.id.z_imageview)
    ImageView zImageview;
    private boolean flag;
    private FragmentManager fm;
    private ImageView voiceImg;
    private String TAG="ZActivity";

    @Override
    public void initList() {
        super.initList();
//        fm.beginTransaction().add(R.id.z_relative,new ConversationFragment()).commit();
        voiceImg = (ImageView) findViewById(R.id.z_voice_img);
    }

    @Override
    public void initView() {
        super.initView();
        setContentView(R.layout.z_activity);
        ButterKnife.bind(this);
        fm = getSupportFragmentManager();
        StatisticsManger.appendComponent(ComponentActType.sdkComponent);

        // 异步方式初始化滤镜管理器 (注意：如果需要一开启应用马上执行SDK组件，需要做该检测，否则可以忽略检测)
        // 需要等待滤镜管理器初始化完成，才能使用所有功能
//        TuSdk.messageHub().setStatus(NewTopicActivity.this, R.string.lsq_initing);
        TuSdk.checkFilterManager(mFilterManagerDelegate);

        Picasso.with(ZActivity.this).load("https://m.en1on1.com/upload/images/b7/6f/e0c5545ee0295adaa5466e0520b5BTeyRR_w1080.jpg").fit().centerCrop().into(zImageview);
    }

    public void doShowDialog(View view){
        showLoading();
    }

    /** 滤镜管理器委托 */
    private FilterManager.FilterManagerDelegate mFilterManagerDelegate = new FilterManager.FilterManagerDelegate()
    {
        @Override
        public void onFilterManagerInited(FilterManager manager)
        {
            Log.e(TAG,"初始化完成了");
            TuSdk.messageHub().showSuccess(ZActivity.this, R.string.lsq_inited);
        }
    };

}
